<template>
  <div>
    姓名: <input type="text" v-model="name"><br>
    年龄: <input type="text" v-model="age"><br>
    生日: <input type="text" v-model="bir"><br>
    地址: <input type="text" v-model="address"><br>
    <button @click="addEms" type="primary">添加用户</button>
  </div>

</template>

<script>
export default {
  name: "Add",
  data(){
    return{
      name:"",
      age: "",
      bir: "",
      address: "",

    }
  },
  methods:{
    addEms(){
      this.$axios({
        url:"http://localhost:8989/ems/addEms",
        method:"post",
        data:{
          name:this.name,
          age:this.age,
          bir:this.bir,
          address:this.address,
        }
      }).then(res => {
        this.$router.push("/ems")
      }).catch(error =>{
        console.log("添加失败")
      })
    }
  }
}
</script>

<style scoped>

</style>
